package com.lwj.liwanjia.presenter;

import com.lwj.liwanjia.bean.GwcNumberBean;
import com.lwj.liwanjia.impl.GwcNumberView;
import com.lwj.liwanjia.model.GwcNumberModel;

import rx.Subscriber;

/**
 * Created by Administrator on 2017/10/3.
 */

public class GwcNumberPresenter {
    private GwcNumberModel gwcNumberModel;
    private GwcNumberView gwcNumberView;

    public GwcNumberPresenter(GwcNumberView gwcNumberView) {
        this.gwcNumberView = gwcNumberView;
        gwcNumberModel = new GwcNumberModel();
    }

    public void getGwcNumber(String token) {
        if (gwcNumberView != null) {
            gwcNumberModel.getGwcNumber(token, new Subscriber<GwcNumberBean>() {
                @Override
                public void onCompleted() {

                }

                @Override
                public void onError(Throwable e) {
                    gwcNumberView.showError((Exception) e);
                }

                @Override
                public void onNext(GwcNumberBean gwcNumberBean) {
                    gwcNumberView.getGwcNumber(gwcNumberBean);
                }
            });
        }
    }
}
